public class Main {
    public static void hanota(int n,char pos1,char pos2,char pos3){
        if(n == 1){
            move (pos1,pos3);
            return;
        }
        hanota(n-1,pos1,pos3,pos2);
        move (pos1,pos3);
        hanota(n-1,pos2,pos1,pos3);
    }

    public static void move(char pos1,char pos2){
        System.out.print(pos1+"-->"+pos2);
    }

    public static void main(String[] args) {

        System.out.println();
        hanota(4,'A','B','C');
        System.out.println();

    }


    public static int fib(int n) {
        int last2 = 1;
        int last1 = 1;
        int cur = 0;
        for (int i = 3; i <= n; i++) {
            cur = last1 + last2;
            last2 = last1;
            last1 = cur;
        }
        return cur;
    }

    public static void main6(String[] args) {
        int a = fib(10);
        System.out.println(a);
    }

    public static int sum2(int n ){
        if (n <=9){
            return n;
        }
        return n %10 + sum2(n/10);
    }

    public static void main5(String[] args) {
        System.out.println(sum2(1729));
    }

    public static int sum(int n ){
        if (n == 1){
            return 1;
        }
        return n + sum(n-1);
    }


    public static void main4(String[] args) {
        System.out.println(sum(10));
    }





    public static void fun(int n) {

        if (n <= 9) {
            System.out.println(n % 10);
            return;
        }
        fun(n / 10);
        System.out.println(n%10);
    }


    public static void main3(String[] args) {
        fun(1234);


    }








    public static  int fac(int n){
        if (n == 1){
            return 1;
        }
        int tmp = n * fac(n-1);
        return tmp;
    }

    public static void main2(String[] args) {
        System.out.println(fac(5));
    }





    public static int sum(int a , int b){
        return a + b;
    }
    public static int sum(int a , int b,int c){
        return a + b + c;
    }
    public static double sum(double a , double b){
        return a + b;
    }

    public static void main1(String[] args) {
        int a = 10 ;
        int b = 20 ;
        int ret = sum(a,b);
        System.out.println(ret);

        double d1 = 12.4;
        double d2 = 17.8;
        double ret2 = sum(d1,d2);
        System.out.println(ret2);

        System.out.println(sum(1,2,3));
    }
}